package com.lcq.study.javabase;

import java.io.*;

public class FileTest {
    public static void main(String[] args) {
        //testReader();
        testFileSize();
    }

    private static void testFileSize() {
        File file = new File("D:/test", "rvt2018.rar");
        long length = file.length();
        long totalSpace = file.getTotalSpace();
        long freeSpace = file.getFreeSpace();
        long usableSpace = file.getUsableSpace();
        System.out.println("length:" + length);
        System.out.println("totalSpace:" + totalSpace);
        System.out.println("freeSpace:" + freeSpace);
        System.out.println("usableSpace:" + usableSpace);
    }


    private static void testReader() {
        File file = new File("D:", "hello.txt");
        try {
            BufferedReader reader = new BufferedReader(new FileReader(file));
            String s = reader.readLine();
            System.out.println(s);
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
